package com.xiaobai.onlinereport.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xiaobai.onlinereport.entity.JimuReportDbField;
import com.xiaobai.onlinereport.mapper.JimuReportDbFieldMapper;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dingfeng.xiao
 * @description
 * @date 2024/7/24 16:05
 */
@AllArgsConstructor
@RestController
@RequestMapping("/onlineReport")
public class OnlineReportController {
    private final JimuReportDbFieldMapper jimuReportDbFieldMapper;
    @RequestMapping("/testTree")
    public Object getOnlineReport(String pid) {
        return "[{\"title\":\"一级菜单\",\"value\":\"A01\",\"pid\":\"\",\"id\":\"1\",\"label\":\"一级菜单\",\"children\":[{\"title\":\"一级菜单\",\"value\":\"A02\",\"pid\":\"1\",\"id\":\"2\",\"label\":\"一级菜单\"},{\"title\":\"一级菜单\",\"value\":\"A03\",\"pid\":\"1\",\"id\":\"3\",\"label\":\"一级菜单\"}]}]";
    }
    @RequestMapping("/loadTableHead")
    public JSONObject loadTableHead(Long reportId) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 200);
        jsonObject.put("result", jimuReportDbFieldMapper.loadTableHead(reportId));
        return jsonObject;
    }
}
